package com.etc.entity;

/**
 * @商品的实体类
 * @author
 *
 */
public class Goods {
	/**
	 * goodsid 商品序号 goodsname 商品名 goodsprice 商品价格 goodsinfo 商品简介 goodscount 商品库存
	 * cover 图片地址 typeid 商品类别id shopid 店铺编号 goodsstate 商品状态
	 */
	private int goodsid;
	private String goodsname;
	private double goodsprice;
	private String goodsinfo;
	private int goodscount;
	private String cover;
	private int typeid;
	private int shopid;
	private int goodsstate;
	// 这里这个属性不是表的列，而是按照面向对象的特征(关联)
	private GoodsType type = new GoodsType();
	private String shopname;

	public Goods(int goodsid, String goodsname, double goodsprice, String goodsinfo, int goodscount, String cover,
			int typeid, int shopid, String shopname) {
		super();
		this.goodsid = goodsid;
		this.goodsname = goodsname;
		this.goodsprice = goodsprice;
		this.goodsinfo = goodsinfo;
		this.goodscount = goodscount;
		this.cover = cover;
		this.typeid = typeid;
		this.shopid = shopid;
		this.shopname = shopname;
	}

	/**
	 * @return the shopname
	 */
	public String getShopname() {
		return shopname;
	}

	/**
	 * @param shopname the shopname to set
	 */
	public void setShopname(String shopname) {
		this.shopname = shopname;
	}

	/**
	 * 
	 * @return the type
	 */
	public GoodsType getType() {
		return type;
	}

	/**
	 * 
	 * @param type the type to set
	 */
	public void setType(GoodsType type) {
		this.type = type;
	}

	// 无参构造
	public Goods() {
		// TODO Auto-generated constructor stub
	}

	/**
	 * id自增的带参构造
	 * 
	 * @param goodsname
	 * @param goodsprice
	 * @param goodsinfo
	 * @param goodscount
	 * @param cover
	 * @param typeid
	 * @param shopid
	 * @param goodsstate
	 */
	public Goods(String goodsname, double goodsprice, String goodsinfo, int goodscount, String cover, int typeid,
			int shopid, int goodsstate) {
		super();
		this.goodsname = goodsname;
		this.goodsprice = goodsprice;
		this.goodsinfo = goodsinfo;
		this.goodscount = goodscount;
		this.cover = cover;
		this.typeid = typeid;
		this.shopid = shopid;
		this.goodsstate = goodsstate;
	}

	/**
	 * 带参构造
	 * 
	 * @param goodsid
	 * @param goodsname
	 * @param goodsprice
	 * @param goodsinfo
	 * @param goodscount
	 * @param cover
	 * @param typeid
	 * @param shopid
	 * @param goodsstate
	 */
	public Goods(int goodsid, String goodsname, double goodsprice, String goodsinfo, int goodscount, String cover,
			int typeid, int shopid, int goodsstate) {
		super();
		this.goodsid = goodsid;
		this.goodsname = goodsname;
		this.goodsprice = goodsprice;
		this.goodsinfo = goodsinfo;
		this.goodscount = goodscount;
		this.cover = cover;
		this.typeid = typeid;
		this.shopid = shopid;
		this.goodsstate = goodsstate;
	}

	/**
	 * @return the goodsid
	 */
	public int getGoodsid() {
		return goodsid;
	}

	/**
	 * @param goodsid the goodsid to set
	 */
	public void setGoodsid(int goodsid) {
		this.goodsid = goodsid;
	}

	/**
	 * @return the goodsname
	 */
	public String getGoodsname() {
		return goodsname;
	}

	/**
	 * @param goodsname the goodsname to set
	 */
	public void setGoodsname(String goodsname) {
		this.goodsname = goodsname;
	}

	/**
	 * @return the goodsprice
	 */
	public double getGoodsprice() {
		return goodsprice;
	}

	/**
	 * @param goodsprice the goodsprice to set
	 */
	public void setGoodsprice(double goodsprice) {
		this.goodsprice = goodsprice;
	}

	/**
	 * @return the goodsinfo
	 */
	public String getGoodsinfo() {
		return goodsinfo;
	}

	/**
	 * @param goodsinfo the goodsinfo to set
	 */
	public void setGoodsinfo(String goodsinfo) {
		this.goodsinfo = goodsinfo;
	}

	/**
	 * @return the goodscount
	 */
	public int getGoodscount() {
		return goodscount;
	}

	/**
	 * @param goodscount the goodscount to set
	 */
	public void setGoodscount(int goodscount) {
		this.goodscount = goodscount;
	}

	/**
	 * @return the cover
	 */
	public String getCover() {
		return cover;
	}

	/**
	 * @param cover the cover to set
	 */
	public void setCover(String cover) {
		this.cover = cover;
	}

	/**
	 * @return the typeid
	 */
	public int getTypeid() {
		return typeid;
	}

	/**
	 * @return the shopid
	 */
	public int getShopid() {
		return shopid;
	}

	/**
	 * @param shopid the shopid to set
	 */
	public void setShopid(int shopid) {
		this.shopid = shopid;
	}

	/**
	 * @return the goodsstate
	 */
	public int getGoodsstate() {
		return goodsstate;
	}

	/**
	 * @param goodsstate the goodsstate to set
	 */
	public void setGoodsstate(int goodsstate) {
		this.goodsstate = goodsstate;
	}

	@Override
	public String toString() {
		return "商品信息 [商品id=" + goodsid + ", 商品名称=" + goodsname + ", 商品价格=" + goodsprice + ", 商品简介=" + goodsinfo
				+ ", 商品库存=" + goodscount + ", 图片地址=" + cover + ", 类别id=" + typeid + ", 商店id=" + shopid + ", 商品状态="
				+ goodsstate + ", type=" + type + "]";
	}

	// 以下赋值是给type对象进行赋值

	/**
	 * @param typeid the typeid to set
	 */
	public void setTypeid(int typeid) {
		this.typeid = typeid;
		this.type.setTypeid(typeid);
	}

	/**
	 * @param typename the typename to set
	 */
	public void setTypename(String typename) {
		this.type.setTypename(typename);
	}

	/**
	 * @param typeremark the typeremark to set
	 */
	public void setTypeinfo(String typeremark) {
		this.type.setTypeinfo(typeremark);
	}

}
